import Vue from "vue";
import Router from "vue-router"

Vue.use(Router)

// 每次用户请求都需要创建一个路由实例
// 所以这里不再是导出路由实例，而是创建路由实例的方法
export default function createRouter(){
    return new Router({
      mode: 'history',
      routes:[
        {
            path: '/home',
            component: () => import('../components/index.vue')
        },
        {
            path: '/detail',
            component: () => import('../components/detail.vue')
        },
      ]
    })
  }
  